const app = getApp()
const api = app.globalData.api
let WxParse = require('./wxParse/wxParse.js');
Page({
  onShareAppMessage: function () {
    return {
      title: this.data.title,
      path: '/pages/webView/webView'
    }
  },
  onLoad: function (options){
    let _this = this
    wx.request({
      url: api + '/get_detail/?id=' + options.id + '&appid=' + app.globalData.appid,
      success:function(res){
        let data=res.data.data
        _this.setData({
          title:data.title,
          desc:data.desc
        })
        //设置标题
        wx.setNavigationBarTitle({
          title: '详情'
        })
        app.globalData.route = data.from
        WxParse.wxParse('article', 'html', data.content, _this);
      },
      fail:function(){
        wx.showToast({
          title: '加载失败',
          icon: 'none',
          duration: 2000
        })
      }
    })
  },
  data:{
    title:'',
    desc:''
  }
})